package org.zht.dormpro.dorm.service.base;

import lombok.extern.log4j.Log4j;
import org.zht.dormpro.pub.exception.DataBaseException;
import org.zht.dormpro.pub.exception.JedisException;

@Log4j
public abstract class AbsBaseService {
    public boolean handleBoolean(BaseServiceCallBack service) throws Exception {
        boolean result = false;
        try {
            //执行service
            result = service.handle();
        } catch (DataBaseException e) {
            throw new DataBaseException("数据库逻辑出错!",e);
        } catch (JedisException e){
            throw new JedisException("缓存逻辑出错!",e);
        } catch (Exception e){
            throw new Exception("service执行出错!",e);
        }
        //返回结果
        return result;
    }

}
